<?php
    
    // TITLE: 
    // FILE: 
    // AUTHOR: 
    // REQUIRES: $guest, $titles, $phoneTypes

    //$titleId = $guest->getTitle();
    //$typeId = $phone->getType()->getId();
    
?>
<h3>Name</h3>

<select name="title" onchange="update(<?php echo $guestId; ?>, 'title');">
<?php
    foreach ($titles as $title) {
        $id = $title->getId();
        $title = $title->getTitle();
        $selected = ($id == $titleId) ? ' selected="selected"' : '';
        echo '<option value="' . $id . '"' . $selected . '>' . $title . '</option>';
    }
?>
</select> <label>Title</label><br>
<input type="text" name="firstName" value="<?php echo $guest->getFirstName(); ?>" placeholder="First Name" onchange="update(<?php echo $guestId; ?>, 'firstName')">
<input type="text" name="middleInitial" value="<?php echo $guest->getMiddleInitial(); ?>" placeholder="Middle Initial" onchange="update(<?php echo $guestId; ?>, 'middleInitial')">
<input type="text" name="lastName" value="<?php echo $guest->getLastName(); ?>" placeholder="Last Name" onchange="update(<?php echo $guestId; ?>, 'lastName')"><br>

<h3>Phone</h3>

<input type="text" name="phone" value="<?php echo $guest->getPhone(); ?>" onchange="update(<?php echo $guestId; ?>, 'phone')"><br>
<select name="type" onchange="update(<?php echo $guestId; ?>, 'type');">
<?php
    foreach ($phoneTypes as $type) {
        $id = $type->getId();
        $title = $type->getTitle();
        $selected = ($id == $typeId) ? ' selected="selected"' : '';
        echo '<option value="' . $id . '"' . $selected . '>' . $title . '</option>';
    }
?>
</select> <label>Phone Type</label><br>
<br>

<h3>Email</h3>

<input type="text" name="email" value="<?php echo $guest->getEmail(); ?>" onchange="update(<?php echo $guestId; ?>, 'email')"><br>
